<?php 
    require_once '../../common/DBHelper.php';
    // 把id从$_POST里面拿出来
    $id = $_POST['id'];
    // 把id从数组里面删除
    // 因为修改不需要id
    unset($_POST['id']);
    $res = update('posts',$_POST,$id);
    
    $response = ['code' => 0,'msg' => '操作失败'];
    if($res){
        $response['code'] = 1;
        $response['msg'] = '操作成功';
    }
    echo json_encode($response,JSON_UNESCAPED_UNICODE);
?>